<?php

class Test_SMSGateway {
    
    /**
     * 测试短信发送
     */
    public function testSend() {
        V::addLibrary('third', dirname(V_PATH).'/common-lib/third');
        $conf = array(
            'smsgateway' => array(
                '86' => array('engine' => 'WebChinese', 'option' => array('account' => 'dingusxp', 'seckey' => '***',)),
                '62' => array('engine' => 'Zenziva', 'option' => array('account' => 'zmch50', 'seckey' => '***',)),
            ),
        );
        V::loadConfig($conf);
        $smsgateway = SMSGateway::getInstance();
//        $mobile = '+8618500522185';
//        $content = '这是一条测试短信，收到请告诉 peng :)';
        $mobile = '+6281290276488';
        $content = 'This is a message for test. Please tell Elvanly or Peng on wechat when you received :)';
        try {
            $ret = $smsgateway->send($mobile, $content);
            return $ret ? true : false;
        } catch (Exception $e) {
            echo 'Exception: ', $e->getMessage(), PHP_EOL;
            return false;
        }
    }
}